home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Extensn.cpp
-
- Contains: Implementation of ODExtension class.
-
- Owned by: Nick Pilch
-
- Copyright: © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 1/16/96 VL 1170098: Make the class (subclass) dynamic
- so that the library can be unloaded.
- <14> 10/8/95 TJ Fixes Recomended by Refball
- <13> 8/16/95 NP 1275241: IDL Review. Remove unnecessary
- overrides.
- <12> 8/3/95 RR #1257260: Collapse B classes. Remove
- somInit methods. Don't call IsInitialized
- or SubclassResponsibility
- <11> 6/22/95 jpa Call inherited Release method. [1261632]
- <10> 6/20/95 JP 1251250: Made Release call ReleaseExtension
- <9> 4/28/95 eeh 1242417: raise error in CheckValid
- <8> 4/26/95 CG 1211082 BB: 5$ Bugs need to be evaluated
- and removed from Core
- <7> 4/14/95 TÇ #1239963 BB: InitExtension needs to call
- InitRefCntObject NOT InitObject
- -- Note: this should allow ShellPlugIns to
- work. Yeah!
- <6> 8/28/94 VL 1181298: Removed Release as ODExtension is
- a subclass of RefCntObject now.
- <5> 8/19/94 NP 1181622: Ownership fix.
- <4> 8/15/94 TÇ #1181162 Added BaseRemoved, IsValid &
- CheckValid
- <3> 7/8/94 NP Fixed Initialization.
- <2> 6/24/94 CG Initialization clean up.
- <1> 6/23/94 CG first checked in
- <0> 6/22/94 SV SOMverted
- <2> 3/15/94 MB Changes to support SCpp/ASLM builds,
- #1150864.
- <3> 1/14/94 NP Init changes.
- <2> 4/28/93 NP File name changes.
- <1> 4/27/93 NP first checked in
-
- To Do:
- In Progress:
-
- */
-
- #define ODExtension_Class_Source
- #define VARIABLE_MACROS
- #include <Extensn.xih>
-
- #ifndef SOM_SOMClass_xh
- #include <somcls.xh>
- #endif
-
- #ifndef SOM_SOMObject_xh
- #include <somobj.xh>
- #endif
-
- #pragma segment ODExtension
-
-
- //==============================================================================
- // ODExtension
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // ODExtension: Initialize
- //------------------------------------------------------------------------------
-
-
- SOM_Scope void SOMLINK ODExtensionInitExtension(ODExtension *somSelf, Environment *ev,
- ODObject* base)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","InitExtension");
-
- SOM_TRY
-
- /* Moved from somInit. SOM itself sets fields to zero
- _fBase = kODNULL;
- */
- somSelf->InitRefCntObject(ev);
-
- _fBase = base;
-
- SOMClass* cls = somSelf->somGetClass();
- cls->somMakeDynamicClassReference();
- somReleaseClassReference ( cls );
-
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // ODExtension: GetBase
- //------------------------------------------------------------------------------
-
- SOM_Scope ODObject* SOMLINK ODExtensionGetBase(ODExtension *somSelf, Environment *ev)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","GetBase");
-
- return _fBase;
- }
- #if 0
- SOM_Scope void SOMLINK ODExtensionsomUninit(ODExtension *somSelf)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","somUninit");
-
- ODExtension_parent_ODRefCntObject_somUninit(somSelf);
- }
- #endif /* 0 */
- SOM_Scope void SOMLINK ODExtensionRelease(ODExtension *somSelf, Environment *ev)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","Release");
-
- ODExtension_parent_ODRefCntObject_Release(somSelf,ev);
-
- if (_fBase != kODNULL && somSelf->GetRefCount(ev) == 0)
- _fBase->ReleaseExtension(ev, somSelf);
- }
-
- SOM_Scope void SOMLINK ODExtensionBaseRemoved(ODExtension *somSelf, Environment *ev)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","BaseRemoved");
-
- _fBase = kODNULL;
- }
-
- SOM_Scope ODBoolean SOMLINK ODExtensionIsValid(ODExtension *somSelf, Environment *ev)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","BaseRemoved");
-
- return (_fBase != kODNULL);
- }
-
- SOM_Scope void SOMLINK ODExtensionCheckValid(ODExtension *somSelf, Environment *ev)
- {
- ODExtensionData *somThis = ODExtensionGetData(somSelf);
- ODExtensionMethodDebug("ODExtension","CheckValid");
-
- if (_fBase == kODNULL)
- ODSetSOMException( ev, kODErrInvalidExtension );
- }
-
-